package com.xqyq.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.xqyq.model.Report;
import com.xqyq.service.ReportService;

@Controller
public class ReportContorller {

	@Autowired
	public ReportService reportService;
	
	@RequestMapping("/report.html")
	public String report(HttpServletRequest request,
			@RequestParam("report_id") int report_id) {
		Report report = reportService.getTheWholeReport(report_id);
		request.setAttribute("report", report);
		return "front/report";
	}

	@RequestMapping("/report_list.html")
	public String reportList(HttpServletRequest request) {
		List<Report> reportList = reportService.getReports(100);
		request.setAttribute("reportList", reportList);
		return "front/report_list";
	}
	
}
